<%@ page import="java.util.Enumeration" %><%--
  Created by IntelliJ IDEA.
  User: troy
  Date: 2017/1/8
  Time: 15:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String res = "{\n" +
            "\t\"result\": \"%s\",\n" +
            "\t\"runStatus\": \"SUCCESS\"\n" +
            "}";
    request.setCharacterEncoding("UTF-8");

    Enumeration enume = request.getParameterNames();
    StringBuilder info = new StringBuilder();
    while (enume.hasMoreElements()) {
        String name = enume.nextElement().toString();
        String value = request.getParameter(name);
        info.append(name).append(":").append(value).append(";");

        if ("parameter".equals(name) && "exception".equals(value)) {
            throw new Exception("This is the exception I throw , " + name + "='" + value + "'");
        }

    }
    info = new StringBuilder(new String(info.toString().getBytes("ISO-8859-1"), "UTF-8"));
    System.out.println(info);
%>
<%=String.format(res, info)%>